//
//  Define.h
//  DCProject
//
//  Created by bigbing on 2019/3/31.
//  Copyright © 2019 bigbing. All rights reserved.
//

#ifndef Define_h
#define Define_h



//ApiBaseUrl 0 线上  1 测试
#define versionFlag 0

#if versionFlag == 1
#define DC_RequestUrl @"http://www.maoxga.cn/"
#define DC_ImageUrl @""
#define DC_H5BaseUrl @""
#else
#define DC_RequestUrl @"http://172.18.1.67:18192/"
#define DC_ImageUrl @""
#define DC_H5BaseUrl @""
#endif

// APP Store下载地址
#define DCShareDownloadUrl @"https://itunes.apple.com/app/id1491300054?mt=8"
// APP Store下载地址测试
#define DCAppVersionUrl @"https://itunes.apple.com/lookup?id=1491300054"

#pragma mark - 第三方SDK、Key值
// 美洽
#define DCMeiQia_AppKey @"5fafe9f66a8239bb49521b9404dea233"
#define DCMeiQia_SecretKey @"$2a$12$MG8q3julyGr.pI/M7cOque0r5x2PSRX4T9MyBSBRD85z7IQcGWgzK"
// 客服id
#define DCMeiQia_ServiceID @"1275429"//原ID：@"5c8b331d8c3412d08c287353bb9c08ef"

// 高德地图
#define DCAmap_AppKey @"1db6b1d94a32d2e8d48f90a29b89c959"

// 激光推送
#define DCJPush_AppKey @"fc00043727db8e0ce06a5693"
#define DCJPush_Secret @"26167c7a68d920570378081b"

// 腾讯Bugly
#define DCBugly_AppiD @"623ac323b3"

// 友盟
#define DCUM_AppKey @"5e041a9a570df3950200099f"

// 微信
#define DCWX_AppKey @"wxaa0edaddedbf1f94"
#define DCWX_AppSecret @"0e15c231bd03ba3f364c40a3b8d45e2d"
#define DCWX_UniversalLinks @"https://www.maoxga.cn/iosapp/"

// 支付宝
#define DCAlipay_AppScheme @"com.china60.jzshoping"

// 腾讯
#define DCQQ_AppKey @"101830605"
#define DCQQ_AppSecret @"bddd19913cbe4b01c167342a73b680a5"

// 新浪微博
#define DCSina_AppKey @""
#define DCSina_AppSecret @""

// 加解密字符串key值
#define DCEncryptKey @"DCEncryptKey"


// apple支付id
#define DCApplePay_ID1 @"com.haoniu.project.yijia.488.1"
#define DCApplePay_ID2 @"com.haoniu.project.yijia.798.1"
#define DCApplePay_ID3 @"com.haoniu.project.yijia.998.1"

//闪验
#define DCShanYanKey @"Ls6Gj0UB"


/// 获取应用版本号
#define APP_VERSION [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
/// 获取应用build号
#define APP_BUILD [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
/// 获取设备的UUID
#define DIV_UUID [[[UIDevice currentDevice] identifierForVendor] UUIDString]
/// 获取应用的名称
#define APP_NAME [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]
/// 获取应用的bundle ID
#define APP_BUNDELID [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]


/// 颜色RGB
#define RGBA_COLOR(R, G, B, A) [UIColor colorWithRed:((R) / 255.0f) green:((G) / 255.0f) blue:((B) / 255.0f) alpha:A]
#define RGB_COLOR(R, G, B) [UIColor colorWithRed:((R) / 255.0f) green:((G) / 255.0f) blue:((B) / 255.0f) alpha:1.0f]

//#define kStatusBarHeight [UIApplication sharedApplication].statusBarFrame.size.height
///// 屏幕高度
//#define kScreenH [UIScreen mainScreen].bounds.size.height
///// 屏幕宽度
//#define kScreenW [UIScreen mainScreen].bounds.size.width
///// tabbar高度
//#define kTabBarHeight (kStatusBarHeight > 20 ? 83 : 49)
///// 导航栏高度
//#define kNavBarHeight (kStatusBarHeight > 20 ? 88 : 64)
///// 消息栏高度
//#define kTabFootBar (kStatusBarHeight > 20 ? 34 : 0)

/// 屏幕高度
#define kScreenH [UIScreen mainScreen].bounds.size.height
/// 屏幕宽度
#define kScreenW [UIScreen mainScreen].bounds.size.width
//状态栏高度
#define kStatusBarHeight [UIApplication sharedApplication].statusBarFrame.size.height
/// 导航栏高度
#define kNavBarHeight ([UIApplication sharedApplication].statusBarFrame.size.height+44)
/// 消息栏高度
#define kTabFootBar [UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom
/// tabbar高度
#define kTabBarHeight ([UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom+50)

/// 消息栏高度
#define kScal(size) (kScreenW*size/375.0)
/// 消息栏高度
#define kScalHeight(size) (kScreenH*size/812.0)

///// 设备型号判断判
//#define iPhoneX (kScreenH == 812) // X 、XS
//#define iPhoneXR (kScreenH == 896) // XR 、XSMax
//#define iPhone6p (kScreenH == 736) // 6p 、6sp 、7p、8p
//#define iPhone6 (kScreenH == 667) // 6 、6s 、7 、8
//#define iPhone5 (kScreenH == 568) // 5、5s
//#define iPhone4s (kScreenH == 480)


/// 弱引用
#define WEAKSELF __weak typeof(self) weakSelf = self;


/// AppDelegate
#define DC_Appdelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
/// sharedApplication
#define DC_Application [UIApplication sharedApplication]
/// 主Window
#define DC_KeyWindow [UIApplication sharedApplication].keyWindow


/// 平方字体
#define PFR [[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 ? @"PingFangSC-Regular" : @"PingFang SC"
#define PFRDIN @"DIN Alternate"
#define PFRSemibold @"PingFangSC-Semibold"
#define PFRMedium @"PingFangSC-Medium"
#define PFRLight @"PingFangSC-Light"
#define PFRRegular @"PingFangSC-Regular"

#define PFRFont(_size) [UIFont fontWithName:PFR size:(_size)]
#define PFRFontSemibold(_size) [UIFont fontWithName:PFRSemibold size:(_size)]
#define PFRFontMedium(_size) [UIFont fontWithName:PFRMedium size:(_size)]
#define PFRFontDIN(_size) [UIFont fontWithName:PFRDIN size:(_size)]

/// 输出中文
#define DC_Printf(responseObject,string) NSData * jsonData = [NSJSONSerialization dataWithJSONObject:(responseObject) options:NSJSONWritingPrettyPrinted error:nil];\
NSString * jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];\
NSLog(@"(string) - %@",jsonStr);


// 打开网页
#define DC_CanOpenUrl(_url) [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:_url]]
#define DC_OpenUrl(_url) [[UIApplication sharedApplication] openURL:[NSURL URLWithString:_url]]


/// 打印log
#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NSLog(FORMAT, ...) nil
#endif


///// 系统版本号
//#define VER_IPHONE_9_0 [[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0
//#define VER_IPHONE_10_0 [[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0
//#define VER_IPHONE_11_0 [[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0
//#define VER_IPHONE_12_0 [[[UIDevice currentDevice] systemVersion] floatValue] >= 12.0

//非空判断
#define SAFEPARAMETER(parameter) ((!parameter || parameter == (id)kCFNull) ? @"" : (parameter))

//com.yijia.shopvip.198


#pragma mark - runtime
#import <objc/runtime.h>
/*! runtime set */
#define DC_Objc_setObj(key, value) objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC)

/*! runtime setCopy */
#define DC_Objc_setObjCOPY(key, value) objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_COPY)

/*! runtime get 黑魔法 */
#define DC_Objc_getObj objc_getAssociatedObject(self, _cmd)

/*! runtime exchangeMethod */
#define BAKit_Objc_exchangeMethodAToB(originalSelector,swizzledSelector) { \
Method originalMethod = class_getInstanceMethod(self, originalSelector); \
Method swizzledMethod = class_getInstanceMethod(self, swizzledSelector); \
if (class_addMethod(self, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) { \
class_replaceMethod(self, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); \
} else { \
method_exchangeImplementations(originalMethod, swizzledMethod); \
} \
}


#endif /* Define_h */
